#include "TuxSpyConfig.h"
#include "TuxSpyStruct.h"
#include <wx/xml/xml.h>

CTuxSpyConfig::CTuxSpyConfig(void)
{
}

CTuxSpyConfig::~CTuxSpyConfig(void)
{
}

int CTuxSpyConfig::GetSysConfig()
{
#if 0
	wxXmlDocument doc;
	wxXmlNode *child;
	SysConfig config;
	TuxAlarmSet tuxalarmset;

	if( !doc.Load("Config.xml") ) {
		wxMessageBox( wxT("Failed to load Config.xml!") );
		return -1;
	}

	if (doc.GetRoot()->GetName() != wxT("TUXSPYCONFIG")) {
		wxMessageBox( wxT("The Config.xml is uncorrected!") );
		return -1;
	}
	syscfgarray.Empty();	
	tuxalarmarray.Empty();
	child = doc.GetRoot()->GetChildren();
	
	while( child) {
		if( child->GetName() == wxT("SITE") ){
			config.SiteType = child->GetPropVal(wxT("TYPE"), wxT("N/A"));
			config.SiteIP = child->GetPropVal(wxT("SITEIP"), wxT("N/A"));
			config.SitePort = child->GetPropVal(wxT("SITEPORT"),wxT("N/A"));
			config.SiteInterval = child->GetPropVal(wxT("INTERVAL"), wxT("5"));
			config.User_Pwd = child->GetPropVal(wxT("AUTH"), wxT("N/A"));
			config.Flag = child->GetPropVal(wxT("FLAG"), wxT("N/A"));
			syscfgarray.Add( config );
		} 
		if( child->GetName() == wxT("ALARM") ){
			tuxalarmset.EmailEnable = child->GetPropVal(wxT("EMAIL"), wxT("FALSE"));
			tuxalarmset.PlaySound = child->GetPropVal(wxT("PLAYSOUND"), wxT("FALSE"));
			tuxalarmset.SMSEnable = child->GetPropVal(wxT("SMS"), wxT("FALSE"));
			tuxalarmset.LongBusy = child->GetPropVal(wxT("LONGBUSY"), wxT(""));
			tuxalarmset.NoTran = child->GetPropVal(wxT("NOTRAN"), wxT(""));
			tuxalarmset.Queued = child->GetPropVal(wxT("QUEUED"), wxT(""));
			tuxalarmset.SvrDied = child->GetPropVal(wxT("SVRDIED"), wxT(""));
			tuxalarmset.SiteName = child->GetPropVal(wxT("NAME"), wxT("N/A"));
			tuxalarmarray.Add( tuxalarmset );
		} 
		child = child->GetNext();
	}
	return 1;
#endif
	return 1;
}

#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(SysConfigArray);
//WX_DEFINE_OBJARRAY(TuxAlarmSetArray);